<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>

    Promise.race([
        new Promise((resolve, reject) => {
            setTimeout(() => {
                reject('失败')
            }, 1000)
        }),
        new Promise((resolve, reject) => {
            setTimeout(() => {
                reject('失败')
            }, 2000)
        }),
        new Promise((resolve, reject) => {
            setTimeout(() => {
                resolve('成功')
            }, 3000) 
        })
    ]).then(res => {
        console.log(res);
    }).catch(err => {
        console.log(err);
    })
</script>

</html>